package com.systop.asset.controller;

import java.util.List;
import com.systop.asset.entity.RestResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.systop.asset.entity.Disposal;
import com.systop.asset.service.IDisposalService;


/**
 * 处置单Controller
 * 
 * @author mc
 * @date 2025-07-03
 */
@RestController
@RequestMapping("/system/disposal")
public class DisposalController
{
    @Autowired
    private IDisposalService disposalService;

    /**
     * 查询处置单列表
     */
    @GetMapping("/list")
    public RestResponse list(Disposal disposal)
    {
        List<Disposal> list = disposalService.selectDisposalList(disposal);
        return RestResponse.success(list);
    }



    /**
     * 获取处置单详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:disposal:query')")
    @GetMapping(value = "/{id}")
    public RestResponse getInfo(@PathVariable("id") Long id)
    {
        return RestResponse.success(disposalService.selectDisposalById(id));
    }

    /**
     * 新增处置单
     */
    @PostMapping
    public RestResponse add(@RequestBody Disposal disposal)
    {
        return RestResponse.success(disposalService.insertDisposal(disposal));
    }

    /**
     * 修改处置单
     */
    @PutMapping
    public RestResponse edit(@RequestBody Disposal disposal)
    {
        return RestResponse.success(disposalService.updateDisposal(disposal));
    }

    /**
     * 删除处置单
     */
	@DeleteMapping("/{ids}")
    public RestResponse remove(@PathVariable Long[] ids)
    {
        return RestResponse.success(disposalService.deleteDisposalByIds(ids));
    }
    @GetMapping("/detail")
    public RestResponse detail(String id)
    {
        return RestResponse.success(disposalService.selectDisposalDetail(id));
    }
}
